package com.nlx.notes.module.bean.vo;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

@Getter
@Setter
@ToString
public class ResultVO<T> extends ResultBaseVO {

    /**
     * 数据
     */
    private T data;

    public ResultVO() {
    }

    public ResultVO(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public  static <T>  ResultVO<T> success(T data) {
        return new ResultVO<>(200, "Success", data);
    }

    public static  <T> ResultVO<T> error(String message) {
        return new ResultVO<>(500, message, null);
    }

    public static  <T> ResultVO<T> error(int code,String message) {
        return new ResultVO<>(code, message, null);
    }



}
